package com.zerous.staria.screens;

import com.zerous.framework.*;
import com.zerous.framework.ui.*;
import com.zerous.framework.utill.*;
import com.zerous.staria.*;
import com.zerous.staria.world.*;

public class GameScreen extends Screen
{
	Vector2 v, a, p, d, aa;
	Animation ani;
	Button btn;
	CheckBox cb;
	World w;
	public GameScreen(Game g, Screen par)
	{
		//java.util.function.Function f;
		super(g, par);
		p = new Vector2(500f, 500f);
		v = new Vector2(0, 0);
		a = new Vector2(0, 0);
		aa = new Vector2(0.01, 0);
		d = new Vector2(-0.8, -0.8);
		btn = new Button(150 + 20, Zex.Const.height - 150 - 20, 150, 150);
		cb = new CheckBox(200, 200, 200, 200);
		w = new World();
		/*btn.setOnTouch(new UIBase.OnTouch() { 
			public void touch()
			{
				a.setX(1);
			}
		});*/
		ani = new Animation(Images.get("one"), Images.images.get("two"), Images.images.get("three")).setFPE(5);
		//char[] aa = "hah";
	}

	@Override
	public void update()
	{
		btn.update();
		cb.update();
		//Game.DEBUG = cb.isCheckin();
		//if(v.x.add(a.x).floatValue() <= 10) 
			
		
		p.add(v.add(a));
		if(p.add(v.add(a)).getX() + 20>= 1500)
		{
			//v.mul(d);
			//a.filp('x').mul(d);
			p.setX(1500 - 20);
		}
		
		if(v.x.equals(1))
		{
			v.clear();
			a.clear();
		}
	}

	@Override
	public void render()
	{
		Zex.graphics.clear(Color.white);
		Zex.graphics.drawText(/*p.copy().add(v.copy().add(a.copy())).getX()*/" : " + Images.ONE.getHeight(), 500, 50);
		Zex.graphics.drawText(Zex.input.getTouch(0).toString(), 500, 90);
		Zex.graphics.drawCircle(p, 20);
		//Zex.graphics.drawPixmap(Images.get("one"), p.x.intValue(), p.y.intValue(), 255);
		w.draw();
		btn.draw();
		cb.draw();
		Zex.graphics.drawRect(1500, 0, 1, 2048);
		//ani.draw(20, 30);
	}
}
